clear *

set seed 12345

use "${root}/data/processed/final_sample.dta"

* for efficiency keep only observations and variables that will be used
keep if baseline_sample == 1
keep mun_code year res_social_exp_avg_share res_social_exp_avg_pc margin_mayor_left *_sample lame_duck

* call program to make placebo graphs
do "${root}/codes/analysis/programs/placebograph_prog.do"


* whole sample
rdplacebo res_social_exp_avg_share, name(baseline_share) height(25) sample(baseline_sample) title("Social Expenditures share")
rdplacebo res_social_exp_avg_pc, name(baseline_pc) height(20) sample(baseline_sample) title("Social Expenditures per capita")

graph combine baseline_share baseline_pc, xcommon row(2) cols(2) xsize(6) ysize(2) iscale(1.5)
graph export "${root}/results/figures/placebo_baseline.pdf", replace

* lame duck sample
rdplacebo res_social_exp_avg_share, name(lameduck_share) height(20) sample(lame_duck) title("Social Expenditures share")
rdplacebo res_social_exp_avg_pc, name(lameduck_pc) height(20) sample(lame_duck) title("Social Expenditures per capita")

graph combine lameduck_share lameduck_pc, xcommon row(2) cols(2) xsize(6) ysize(2) iscale(1.5)
graph export "${root}/results/figures/placebo_lameduck.pdf", replace

* oil sample
rdplacebo res_social_exp_avg_share, name(oilsample_share) height(25) sample(oil_sample) title("Social Expenditures share")
rdplacebo res_social_exp_avg_pc, name(oilsample_pc) height(15) sample(oil_sample) title("Social Expenditures per capita")

graph combine oilsample_share oilsample_pc, xcommon row(2) cols(2) xsize(6) ysize(2) iscale(1.5)
graph export "${root}/results/figures/placebo_oilsample.pdf", replace

* tiebout < median
rdplacebo res_social_exp_avg_share, name(tieboutmed_share) height(25) sample(tiebout_median_sample) title("Social Expenditures share")
rdplacebo res_social_exp_avg_pc, name(tieboutmed_pc) height(15) sample(tiebout_median_sample) title("Social Expenditures per capita")

graph combine tieboutmed_share tieboutmed_pc, xcommon row(2) cols(2) xsize(6) ysize(2) iscale(1.5)
graph export "${root}/results/figures/placebo_tmed.pdf", replace

* coalition ideology distance > median
rdplacebo res_social_exp_avg_share, name(ideomed_share) height(25) sample(coal_dist_median_sample) title("Social Expenditures share")
rdplacebo res_social_exp_avg_pc, name(ideomed_pc) height(15) sample(coal_dist_median_sample) title("Social Expenditures per capita")

graph combine ideomed_share ideomed_pc, xcommon row(2) cols(2) xsize(6) ysize(2) iscale(1.5)
graph export "${root}/results/figures/placebo_ideomed.pdf", replace
